public class Test {
    public static void main(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addLast(1);
        mySingleList.addLast(2);
        mySingleList.addLast(3);
        mySingleList.addLast(4);
        mySingleList.display();
        MySingleList.ListNode ret = mySingleList.middleNode();
        System.out.println(ret.val);
    }
    public static void main2(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addLast(1);
        mySingleList.addLast(2);
        mySingleList.addLast(3);
        mySingleList.addLast(4);
        mySingleList.addLast(5);
        mySingleList.display();
        //翻转
        System.out.println("翻转....");
        //mySingleList.reverseList();
        //指定位置打印
        MySingleList.ListNode ret = mySingleList.reverseList();
        mySingleList.display(ret);
    }
    public static void main1(String[] args) {
        MySingleList mySingleList = new MySingleList();
//        mySingleList.createList();//依次创建链表
//        mySingleList.display();
        //头插
   /*     mySingleList.addFirst(1);
        mySingleList.addFirst(2);
        mySingleList.addFirst(3);
        mySingleList.addFirst(4);
        mySingleList.addFirst(5);
        mySingleList.display();*/
        //任意位置插入
        //mySingleList.addIndex(0,999);
        //尾插
        mySingleList.addLast(9);
        mySingleList.addLast(9);
        mySingleList.addLast(9);
        mySingleList.addLast(8);
        mySingleList.display();
//        mySingleList.addIndex(5,9);
//        mySingleList.addIndex(11,9);
//        mySingleList.remove(2999);
        mySingleList.removeAllKey(9);
        mySingleList.display();
        System.out.println(mySingleList.contains(6));

    }
}
